import { Controller, Get, Inject } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { AppService } from './app.service';
import { ListService } from './list/list.service'; //全局服务注入的共享模块

@Controller()
@ApiTags('根元素')
export class AppController {
  constructor(
    private readonly appService: AppService,
    @Inject('Config') private readonly Baseurl: any, //注入的共享动态模块
    private readonly listService: ListService, //全局服务注入的共享模块
  ) {}

  @Get()
  @ApiOperation({
    summary: '根共享动态接口',
  })
  getHello(): string {
    console.log('Baseurl', this.Baseurl);
    return this.appService.getHello() + JSON.stringify(this.Baseurl);
  }
  @Get('mianList') //共享的list
  @ApiOperation({
    summary: '测试共享的接口',
    description: '共享的list',
  })
  getHelloList(): string {
    return this.listService.findAll();
  }
}
